﻿using Publicuse.ExpressionTool.Visitor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Publicuse.ExpressionTool.DBExtend
{
    public static class ExpressionExtension
    {
        public static void BatchDelete<T>(this IQueryable<T> entities, Expression<Func<T, bool>> expr)
        {
            ConditionBuilderVisitor visitor = new ConditionBuilderVisitor();
            visitor.Visit(expr);
            string condition = visitor.Condition();
            string sql = $"DELETE FROM[{typeof(T).Name}] WHERE {condition}";
            //然后执行sql
        }

    }
}
